<%--
	fileName      : /opermgmt/WebContent/customermgmt/propay.jsp
	author        : lenovo
	createDate    : 2016-10-26  10:52:13
	lastModifier  : lenovo
	lastModifyDate: 2016-10-26  10:52:13
	description   : 请添加描述
--%>

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="ctp-tag" prefix="ctp" %>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<title>产品到期兑付 ,冷静期产品查询</title>
	<ctp:include items='borderlayout,panel,groupbox,toolbar,textfield,button,gridlayout,multiselect,combobox,form,validator,textarea,label,radiogroup,checkbox,vwizard,message_ex,datepicker,checkboxgroup,grid'/>
		<script type='text/javascript' kind='variant'>
			var borderlayout1;
	        var queryForm;
	        var queryGridlayout;
	        var panel ;
	        var prolist;
	        var startTime;//开始时间
	        var endTime;//结束时间
	        var pro;//产品
	        var tranStatus;
	        var toolbar;
	        var proid='';
	        var label1;
	        var flag='<ctp:out name="flag"/>';//0 产品到期兑付查询,1 冷静期产品查询
	        var selValue='';
        </script>
        <script type='text/javascript' kind='event'>
        /*
         * @method getQueryInfo
         * @desc  获取表单查询条件
         * @author lenovo
         */ 
        function getQueryInfo(){
            var queryInfo =  					
				"&startTime=" + startTime.getValue()  					
				+"&endTime=" + endTime.getValue() 					
				+"&proId=" + proid;
            return queryInfo;
        }
            /*
	         * @method submitForm
	         * @desc  表单提交
	         * @author lenovo
	         */ 
            function submitForm(){
            	var url;
            	if(label1.getValue()==''||label1.getValue().length<=0){
					alert("请选择产品项目");
					return;
                }
                if(flag=='0'){
                	url='<ctp:url href="querystatistics.flowc" flowActionName="querypropay" params="language=sessCtx.Language;userId=sessCtx.user.id;begNum=1;fetchNum=1;" />'+getQueryInfo();
                }else{
            		url='<ctp:url href="querystatistics.flowc" flowActionName="querycoppro" params="language=sessCtx.Language;userId=sessCtx.user.id;begNum=1;fetchNum=1;" />'+getQueryInfo();
                }
            	prolist.loadData(url);
            }
            /*
	         * @method resetForm
	         * @desc  表单重置
	         * @author lenovo
	         */ 
            function resetForm(){
            	proid='';
            	queryForm.reset();
            }
            
            function exportexcel(){
            	if(flag=='0'){
            		window.location.href='<ctp:url href="querystatistics.flowc" flowActionName="exportquerypropay" params="language=sessCtx.Language;userId=sessCtx.user.id"/>&flag=1'+getQueryInfo();
            	}else{
            		window.location.href='<ctp:url href="querystatistics.flowc" flowActionName="exportquerycoppro" params="language=sessCtx.Language;userId=sessCtx.user.id"/>&flag=1'+getQueryInfo();
                }
            }

            function edit(){
            	
            	var srcPath = '<ctp:url href="querystatistics.flowc" flowActionName="querypro"/>&selValue='+selValue;
            	
	        	ctpMSB.win({
		        	message:srcPath,
		        	width:800,
		        	height:400,
		        	title:'选择产品',
		        	handler:handler1,
		        	minBtn:true,
		        	iframe:true});
            }
            function handler1(data){
            	var proText=data.text;
            	var proValue=data.value;
            	label1.setValue(proText);
            	selValue=proValue;
            	//选中多条数据，需要拆分加上单引号，sql中使用
            	if(proValue.indexOf(',')>0){
					var proValueArray=proValue.split(',');
					proid=proValueArray[0];
					for(var i=1;i<proValueArray.length;i++){
						proid+="','"+proValueArray[i];
					}
                }else{proid=proValue;}
                //判断是否已有已选产品输入框，有就不用添加了
                /* if(queryGridlayout.getObjs('textfield').length>0){
                	label1.setValue(proText);
                	
                }else{
	            	label1=new ctp.ui.textarea({
	         		    id: 'selectedpro',
	         		    width: '100%'					
	         		}); 
	         		
	            	label1.setReadOnly(true);
	            	label1.setValue(proText);
	
	            	queryGridlayout.append({
	            		colspan:2,label: {
	    					text: '已选产品'
	    				},
	            		element: label1
	            	},true);
                } */
            }
        </script>
         <script type='text/javascript' kind='ui'>
         function initUI(){
        	 toolbar= new ctp.ui.toolbar({
                 id: 'toolbar1',
                 border: 'bottom',					
                 leftItems: [{
                     id: "button1",
                     type: 'button',
                     text: '导出',
                     icon: 'excel',                        
                     onClick: exportexcel
                 }]
        	 });
        	 
        	 startTime = new ctp.ui.datepicker  ({
					id : 'startTime' ,
					dateFormat:'yymmdd',
					width:'100%',
					type : 'text'
				});	
        	 endTime = new ctp.ui.datepicker  ({
					id : 'endTime' ,
					dateFormat:'yymmdd',
					width:'100%',
					type : 'text'
				});	

				pro= new ctp.ui.button({
	                 id:'edit',
	                 width: '20%',	
	                 text:'选择',
	         		onClick:edit
	             });

				label1=new ctp.ui.textarea({
         		    id: 'selectedpro',
         		    rows:'3',
         		    width: '100%'					
         		}); 
         			
                queryGridlayout = new ctp.ui.gridlayout({
                    id: 'queryGridlayout',
                    width: '850px',
                    align: 'center',
                    defaults:{
            			align: 'center',
            			label: {width: '100px'},element:{type: 'textfield',options:{width: '120px'}}		
            		},  
                    items:  [
     				[
						{
                               label: {
                                   text: '开始时间', 
                                   width: '100px'
                               }, 
                               element: startTime
                       },{
                           label: {
                               text: '结束时间', 
                               width: '100px'
                           }, 
                           element: endTime
                   }],
    				[{colspan:2,
                        label: {
                            text: '产品项目', 
                            width: '100px'
                        }, align: 'left',
                        element: pro
                	}] ,
    				[{colspan:2,
                        label: {
                            text: '已选项目<span style="color:red;">*</span>',
                            width: '100px'
                        }, align: 'left',
                        element: label1
                	}] 
                ] 
                });
                
                queryForm = new ctp.form({
                    id: 'queryForm',
                    postType:'ajax',
                    items: [
    						queryGridlayout
                        ],
                    buttons : [{                           
	                        id: 'submit',              
	                        text: '提交',                  
	                        icon:'apply',
	                        onClick: submitForm 
                 		}, {                                 
	                       id: 'reset',             
	                       text: '重置',                   
	                       icon:'reload',
	                       onClick: resetForm
                 	    }]	
                });

                prolist = new ctp.ui.grid({
                    id: 'prolist',
                    title:'列表',
                    toolbar:toolbar,
                    toolbarPos:'innertop',
                    header: {
                        title: [
                            [
									{	text: '客户名称'},
									{	text: '证件类型'},								
									{	text: '证件编号'},								
									{	text: '产品名称'},								
									{	text: '客户经理'},								
									{	text: '所属机构'},								
									{	text: '认购金额'},								
									{	text: '银行账号'},								
									{	text: '总行名称'},								
									{	text: '分行名称'},								
									{	text: '支行名称'},								
									{	text: '客户打款时间'}			                                
                            ]
                        ],
                        rowIdFieldName: "certno",
                        attr: [
							{	fieldName: "investorname"},
							{	fieldName: "certtype"},
							{	fieldName: "certno"},
							{	fieldName: "proName"},
							{	fieldName: "managerName"},
							{	fieldName: "branchName"},
							{	fieldName: "amount"},
							{	fieldName: "acctno"},
							{	fieldName: "hqbankName"},
							{	fieldName: "fhName"},
							{	fieldName: "accbank"},
							{	fieldName: "transferdate"}                                                   
                        ]
                    },
                    footer: {
						//auto:true 
                    	showRows:14,
                    	cachePages:10                   
                    }
                });

                panel = new ctp.ui.panel({
            	    id:'panel1',
            	    title:'查询条件',	
            	    items:[queryForm]
            	});
               
                borderlayout1 = new ctp.ui.borderlayout({
                    type: '2E',
                    north__size: 0.35,
                    north__items:[panel],
					  center__items:[prolist],
					  center__scrollable:true,
                    renderTo: 'body'
                });

                label1.setReadOnly(true);
            };
            </script>     
	</head>
	<body onload='initUI();'>
	<ctp:form name="queryForm" method="post" action="querystatistics.flowc" flowActionName="">
		<input type="hidden"  name="selValue" value=""/>
	</ctp:form>
	</body>
</html>

<%--
	date        :
	modifyReason:
--%>